﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Bll;
using Model;

namespace Myproject.BSM.PcWeb.PcChannel.Product
{
    public partial class GoodsEdit : System.Web.UI.Page
    {
        private string imgaHtml;

        public string ImgaHtml
        {
            get { return imgaHtml; }
            set { imgaHtml = value; }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string ID = Request.QueryString["id"];
            if (!string.IsNullOrEmpty(ID))
            {
                GoodsModel model = new GoodsBLL().GetModel(int.Parse(ID));
                pc_Channel_GoodsEdit_GoodsId.Value = model.GoodsID.ToString();
                pc_Channel_GoodsEdit_GoodsClassId.Value = model.GoodsClassID.ToString();
                pc_Channel_GoodsEdit_name.Value = model.Name;
                pc_Channel_GoodsEdit_othername.Value = model.OtherName;
                pc_Channel_GoodsEdit_ename.Value = model.EnName;
                doc_pic.Value = model.Url;
                imgaHtml = "已上传图片：<img src='" + model.Url + "' width='100'>";
                pc_Channel_GoodsEdit_class.Value = new GoodsClassBLL().GetModel(model.GoodsClassID).Name;
                pc_Channel_GoodsEdit_text.Value = model.GoodsContent;
            }
            else
            {
                string channelID = Request.QueryString["cid"];
                if (!string.IsNullOrEmpty(channelID))
                {
                    pc_Channel_GoodsEdit_class.Value = new GoodsClassBLL().GetModel(int.Parse(channelID)).Name;
                    pc_Channel_GoodsEdit_GoodsClassId.Value = channelID;
                }
            }
        }
    }
}